#include <iostream>
#include <string>

class GoodFriend;

class Home
{
    friend void GoodFriend::visit(Home &home);

public:
    std::string livingRoom = "客厅";

private:
    std::string bedRoom = "卧室";
};

class GoodFriend
{
public:
    void visit(Home &home);
};

void GoodFriend::visit(Home &home)
{
    std::cout << home.livingRoom << std::endl;
    std::cout << home.bedRoom << std::endl; // 为什么不可以访问bedRoom
}

int main()
{
    Home myHome;
    GoodFriend f1;
    f1.visit(myHome);

    return 0;
}
